<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="app">
        <h2>{{title}}</h2>
        <parent id="2116" :msg="msg"></parent>
    </div>
    <template id="parent">
        <div>
            <h2>Parent - Parent - Parent </h2>
            <h2>{{id}}</h2>
            <h2>{{msg}}</h2>
            <hr>
            <childone :word="word" :city="city"></childone>
        </div>
    </template>
    <template id="childone">
        <div>
            <h2>childone--childone</h2>
            <h2>{{word}}</h2>
            <h2>{{city}}</h2>
        </div>
    </template>
</body>
<script>
    Vue.component('parent', {
        template: "#parent",
        props: ['id', 'msg', 'num'],
        data() {
            return {
                word: "好好学习",
                city: "WH",

            }
        },
        components: {
            childone: {
                template: "#childone",
                props: {
                    word: String,
                    city: [String, Number],
                }
            }
        }
    })
    const vm = new Vue({
        // el:"#app",
        components: {
        },
        data: {
            title: "Vue 组件初步 (组件通信 - props ) ",
            msg: "小型、独立和通常可复用的组件构建大型应用"
        },
        mounted() {
            document.getElementsByTagName('title')[0].innerHTML = this.title
        }
    }).$mount("#app")
</script>

</html>